//
//  SWHomeTitleView.swift
//  MYSwiftWeiBo
//
//  Created by shingwai chan on 16/3/2.
//  Copyright © 2016年 ChanShingWai. All rights reserved.
//

import UIKit

class SWHomeTitleView: UIButton {

    init(title: String) {
    
        super.init(frame: CGRectZero)
        
        self.setTitle(title, forState: UIControlState.Normal)
        self.setBackgroundImage(UIImage(named: "navigationbar_filter_background_highlighted"), forState: UIControlState.Highlighted)
        self.setTitleColor(UIColor.blackColor(), forState: UIControlState.Normal)
        
        self.setImage(UIImage(named: "navigationbar_arrow_down"), forState: UIControlState.Normal)
        self.setImage(UIImage(named: "navigationbar_arrow_up"), forState: UIControlState.Selected)
        
        sizeToFit()
    
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }


    override func layoutSubviews() {
        super.layoutSubviews()
        
        titleLabel?.frame.origin.x = 0
        
        imageView?.frame.origin.x = titleLabel!.frame.width + 3
    }








}
